<%@ Page Title="Sections" Language="C#" MasterPageFile="~/Views/Shared/Template.Master" Inherits="IWS.SiteManager.Web.Views.LayoutView<List<IWS.SiteManager.Core.Model.Section>>" %>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
	<script type="text/javascript">
		$().ready(function() {
			$(".create_section").click(function() {
				window.location = "../Manage/EditSection/";
			});

			$(".delete_button").click(function() {
				return confirm("Are you sure you want to delete this section?");
			});
		});
	</script>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
	<div class="breadcrumb">
		<%=Html.ActionLink("Administration", "Index", "Manage") %> -&gt; Sections
	</div>

	<h2>Sections</h2>
	<input class="create_section" type="button" value="Create Section" />
	<%foreach (var section in Model)
	  { %>
		<h3><%=Html.ActionLink(section.ID, "SectionView", "Manage", new { id = section.ID}, null)%> - <%=section.Pages.Count == 0 ? "No pages" : section.Pages.Count == 1 ? "1 Page" : string.Format("{0} Pages", section.Pages.Count)%> </h3><%=Html.ActionLink("delete", "DeleteSection", new { id=section.ID}, new { @class="delete_button"}) %>
		<p><%=Html.Encode(section.Description) %></p>
	<%} %>

</asp:Content>

